#include "udispbookinfobox.h"
#include <QLabel>
#include <QPushButton>
UDispBookInfoBox::UDispBookInfoBox(QWidget *parent, const QString& title, const QString& author, const QString& press,
	const QString& isbn, const QString& date, const QString& image)
	: QWidget(parent)
	, m_pImage(new QPushButton(this))
	, m_pTitle(new QLabel(this))
	, m_pAuthor(new QLabel(this))
	, m_pPress(new QLabel(this))
	, m_pDate(new QLabel(this))
	, m_pISBN(new QLabel(this))
{
	setAttribute(Qt::WA_StyledBackground, true);//默认Qwidget类 无法设置颜色
	setFixedSize(642, 127);
	setStyleSheet(R"(UDispBookInfoBox{background-color:#F5F5F5;})");
	initLabel();
	m_pTitle->setText(title);
	m_pAuthor->setText(author);
	m_pPress->setText(press);
	m_pDate->setText(date);
	m_pISBN->setText(isbn);
	m_pImage->setIcon(QIcon(image));
}

UDispBookInfoBox::~UDispBookInfoBox()
{}

void UDispBookInfoBox::initLabel()
{
	QString LabelStyleSheet = R"(QLabel{background-color:#FFFFFF;})";
	m_pImage->resize(77, 99);
	m_pImage->move(18, 14);
	m_pImage->setStyleSheet(R"(QPushButton{border:none;})");
	m_pImage->setIconSize(m_pImage->size());


	m_pTitle->resize(240, 50);
	m_pTitle->move(109, 12);
	m_pTitle->setStyleSheet(R"(QLabel{font:#000000;font-family:微软雅黑;font-size: 20px;})");

	m_pAuthor->resize(173, 25);
	m_pAuthor->move(370, 12);
	m_pAuthor->setStyleSheet(R"(QLabel{font:#000000;font-family:微软雅黑;font-size: 12px;})");

	m_pPress->resize(173, 25);
	m_pPress->move(370, 51);
	m_pPress->setStyleSheet(R"(QLabel{font:#000000;font-family:微软雅黑;font-size: 12px;})");

	m_pDate->resize(165, 25);
	m_pDate->move(370, 83);
	m_pDate->setStyleSheet(R"(QLabel{font:#000000;font-family:微软雅黑;font-size: 12px;})");

	m_pISBN->resize(190, 20);
	m_pISBN->move(112, 82);
	m_pISBN->setStyleSheet(R"(QLabel{font:#000000;font-family:微软雅黑;font-size: 12px;})");
}